Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow customizing Cowboy protocol_options #37

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

exAspArk
Copy link

@exAspArk exAspArk commented Aug 17, 2018

Hey,

I often see an error like:

[error] Cowboy returned 400 because it was unable to parse the request headers.

This may happen because there are no headers, or there are too many headers
or the header name or value are too large (such as a large cookie).

You can customize those values when configuring your http/https
server. The configuration option and default values are shown below:

    protocol_options: [
      max_header_name_length: 64,
      max_header_value_length: 4096,
      max_headers: 100,
      max_request_line_length: 8096
    ]

It'll be great if I could override Plug.Adapters.Cowboy protocol_options by adding to my config.ex:

config :trot, :protocol_options, [
  max_header_name_length: 1048576,
  max_header_value_length: 1048576,
  max_headers: 10000,
  max_request_line_length: 1048576
]

Or alternatively, we could namespace the config options and pass them to Cowboy, for example:

config :trot, :http, [
  port: 3000,
  timeout: 5000,
  protocol_options: [
    max_header_name_length: 1048576,
    max_header_value_length: 1048576,
    max_headers: 10000,
    max_request_line_length: 1048576
  ]
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant